package jia.editor;

import jia.game.GenericFlags;
import jia.core.Compass;
import org.apache.log4j.Logger;

import javax.vecmath.Vector2d;

// ====================================================
/**
 * Holds information about a specific screen location's relation to the current
 * module
 *
 * @author Alec Lanter
 */
public class ScreenLocationData{
    private static final Logger log = Logger.getLogger(ScreenLocationData.class);
    private Vector2d moduleLoc;
    private Compass closestWall;
    
    // ====================================================
    /**
     * @return Returns the closestWall.
     */
    public Compass getClosestWall(){
        return closestWall;
    }
    
    // ====================================================
    /**
     * @param closestWall The closestWall to set.
     */
    public void setClosestWall(Compass closestWall){
        this.closestWall = closestWall;
    }
    
    // ====================================================
    /**
     * @return Returns the moduleLoc.
     */
    public Vector2d getModuleLoc(){
        return moduleLoc;
    }
    
    // ====================================================
    /**
     * @param moduleLoc The moduleLoc to set.
     */
    public void setModuleLoc(Vector2d moduleLoc){
        this.moduleLoc = moduleLoc;
    }
    
    //====================================================
    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object o){
        boolean equal = true;
        if(o instanceof ScreenLocationData) {
            ScreenLocationData d2 = (ScreenLocationData) o;
            equal &= d2.getModuleLoc().x == getModuleLoc().x;
            equal &= d2.getModuleLoc().y == getModuleLoc().y;
            // We can do the following since all Compass objects are static instances
            equal &= closestWall == d2.closestWall;
        } else {
            equal = false;
        }
        if(GenericFlags.debugMessages) {
            log.debug("Equals returning " + equal);
        }
        return equal;
    }
}
